package com.eastfair.venuebooking.enumeration;

import com.eastfair.annotation.base.BaseEnum;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.NoArgsConstructor;
import lombok.Getter;

import java.util.stream.Stream;

/**
 * <p>
 * 实体注释中生成的类型枚举
 * 展会
 * </p>
 *
 * @author linan
 * @date 2023-03-22
 */
@Getter
@AllArgsConstructor
@NoArgsConstructor
@ApiModel(value = "ExhibitionIndustryEnum", description = "所属行业 #{INDUSTRY_ONE:农林渔牧;INDUSTRY_TWO:工业智造;INDUSTRY_THREE:新兴产业;INDUSTRY_FOUR:美好生活;OTHER:其他-枚举")
public enum ExhibitionIndustryEnum implements BaseEnum {

    /**
     * INDUSTRY_ONE="农林渔牧"
     */
    INDUSTRY_ONE("农林渔牧"),
    /**
     * INDUSTRY_TWO="工业智造"
     */
    INDUSTRY_TWO("工业智造"),
    /**
     * INDUSTRY_THREE="新兴产业"
     */
    INDUSTRY_THREE("新兴产业"),
    /**
     * INDUSTRY_FOUR="美好生活"
     */
    INDUSTRY_FOUR("美好生活"),
    /**
     * OTHER="其他"
     */
    OTHER("其他"),
    ;

    @ApiModelProperty(value = "描述")
    private String desc;


    /**
     * 根据当前枚举的name匹配
     */
    public static ExhibitionIndustryEnum match(String val, ExhibitionIndustryEnum def) {
        return Stream.of(values()).parallel().filter(item -> item.name().equalsIgnoreCase(val)).findAny().orElse(def);
    }

    public static ExhibitionIndustryEnum get(String val) {
        return match(val, null);
    }

    public boolean eq(ExhibitionIndustryEnum val) {
        return val != null && eq(val.name());
    }

    @Override
    @ApiModelProperty(value = "编码", allowableValues = "INDUSTRY_ONE,INDUSTRY_TWO,INDUSTRY_THREE,INDUSTRY_FOUR,OTHER", example = "INDUSTRY_ONE")
    public String getCode() {
        return this.name();
    }

}
